<template>
	<view :style="{ padding: '20rpx' }">
		<view v-for="i in nodes" :key="i" class="content-box">
			<rich-text class="content" :nodes="i.contents"></rich-text>
		</view>
		<Loading ref="loading"></Loading>
	</view>
</template>

<script>
	import Loading from '@/components/loding.vue'
	import { request } from '@/utils/request.js'
	import { richTextImg } from '@/utils/utils.js'
	export default {
		data() {
			return {
				nodes: [],
			}
		},
		components: {
			Loading
		},
		methods: {
			
		},
		onLoad(option) {
			this.$refs.loading.init()
			this.$refs.loading.progress = 100
			// setTimeout(() => {
			// 	this.$refs.loading.destoryed()
			// }, 1000)
			uni.setNavigationBarTitle({
				title: option.title
			})
			request('/api/hlx-article/detail', { id: option.type  }, 'get').then(res => {
				this.$refs.loading.destoryed();
				if (res.data.code === 200) {
					const detail = res.data.data
					detail.contents = detail.contents ? richTextImg(detail.contents) : ''
					this.nodes = [detail]
					// this.nodes = res.data.rows.map(i => {
					// 	i.contents = i.contents ? richTextImg(i.contents) : ''
					// 	return i
					// })
				}
			})
		}
	}
</script>

<style lang="less" scoped>
	.content-box {
		padding: 28rpx 40rpx;
		background: #FAFAFA;
		border-radius: 26rpx 26rpx 26rpx 26rpx;
		margin-bottom: 30rpx;
		.content {
			font-size: 28rpx;
			font-family: Source Han Sans CN, Source Han Sans CN;
			font-weight: 400;
			color: #000000;
			line-height: 48rpx;
		}
	}
	

</style>
